package com.itheima.controller;

import com.itheima.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Date;

@Controller
@RequestMapping("/param")
public class ParamController {

    @RequestMapping("/test1")
    public String Test1(@RequestParam(value = "username", required = true, defaultValue = "sun") String name, int age) {
        System.out.println("username:" + name);
        System.out.println(age == 18);
        return "success";
    }

    @RequestMapping("test2")
    public String test2(User user, String hobbies) {
        System.out.println(hobbies);
        return "success";
    }

    @RequestMapping("test3")
    public String test3(Date birthday) {
        System.out.println(birthday);
        return "success";
    }

}
